<%--
  Created by IntelliJ IDEA.
  User: Chen
  Date: 2016/2/18
  Time: 23:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fns" uri="/WEB-INF/tlds/fns.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>

<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<h2>
    ${empty choice.id?"添加选题":"查看选题"}
</h2>
<div class="error class alert-danger" style="display: none;padding:10px 0 8px 10px"></div>
<form id="choice-form"  class=" form-horizontal " role="form" style="padding-left: 20px">
    <div class="row">
        <div class="col-md-8">
            <input type="hidden" id="id" name="id" value="${choice.id}">

            <div class="form-group">
                <label for="name" class=" col-sm-2 control-label"><span class="text-fill">*</span> 题目：</label>
                <div class="col-sm-10">
                    <input type="text" class="form-control input-sm required" title="请填写题目名称"  style="font-weight: 500;font-size: 18px; height: 42px;" id="name" name="topic.name" value="${choice.topic.name}">
                </div>
            </div>

            <div class="form-group">
                <label for="type" class="col-sm-2 control-label"><span class="text-fill">*</span>类型：</label>
                <div class="col-sm-4">
                    <c:forEach items="${fns:getDictList('topic_type')}" var="dict">
                        <input type="radio" id="radio${dict.id }"  class="required typeDisable"  id="type" name="topic.type" ${choice.topic.type==dict.value?"checked":""} value="${dict.value }" title="请选择题目类型"> ${dict.label }
                    </c:forEach>
                </div>
            </div>

            <div class="form-group">
                <label for="student" class="col-sm-2 control-label"><span class="text-fill">*</span>选题学生：</label>
                <div class="col-sm-4">
                    <input type="text" class="form-control input-sm required" title="请填写限制人数"  id="student" name="student.name" value="${choice.student.name}">
                </div>
            </div>

            <div class="form-group">
                <label for="creator" class=" col-sm-2 control-label"><span class="text-fill">*</span>出题人：</label>
                <div class="col-sm-4">
                    <input type="text" class="form-control input-sm required"  id="creator" name="topic.creator.id" value="${choice.topic.creator.id}">
                </div>
            </div>

            <div class="form-group">
                <label for="choiceDate" class=" col-sm-2 control-label"><span class="text-fill">*</span>选题时间：</label>
                <div class="col-sm-4">
                <input type="text" class="form-control input-sm " title="选题时间"  id="choiceDate" name="choiceDate" value="${choice.choiceDate}">
                </div>
            </div>

            <div class="form-group">
                <label for="pass" class=" col-sm-2 control-label"><span class="text-fill">*</span>状态：</label>
                <div class="col-sm-10">
                    <c:forEach items="${fns:getDictList('topic_pass')}" var="dict">
                        <input type="radio" id="radio${dict.id }" id="pass" class="required sourceDisable" name="status" ${choice.status==dict.value?"checked":""} value="${dict.value }" > ${dict.label }
                    </c:forEach>
                </div>
            </div>


            <div  style="clear: both">
                <shiro:hasPermission name="sys:menu:edit">
                    <button id="choice-submit" class="btn btn-primary btn-sm" type="button">保 存</button>
                </shiro:hasPermission>
                <button id="choice-cancel" class="btn btn-sm" type="button" onclick="history.go(-1)">返 回</button>
            </div>
        </div>
    </div>
</form>


<script>
    <c:if test="${env == 'pro' }">
    requirejs(['${ctx}/assets/js/app/admin/choice-form-page.js']);
    </c:if>
    <c:if test="${env != 'pro' }">
    requirejs(['${ctx}/assets/js/app/admin/choice-form-page.js']);
    </c:if>

</script>